9<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>骡窝窝系统管理平台</title>
    <#include "../common/header.ftl"/>


    <script type="text/javascript">
        $(function(){
                $("#pagination").twbsPagination({
                    totalPages:${pageInfo.pages},
                    visiblePages:5,
                    startPage:${qo.currentPage},
                    first:"首页",
                    prev:"上一页",
                    next:"下一页",
                    last:"尾页",
                    onPageClick:function(event,page){
                        $("#currentPage").val(page);
                        $("#searchForm").submit();
                    }
                });

                $("#query").click(function(){
                    $("#currentPage").val(1);
                    $("#searchForm").submit();
                });

                //点击保存
                $("#editForm").ajaxForm(function(data){
                    $.messager.confirm("提示","保存成功",function(){
                        window.location.reload();
                    });
                });
                $("#saveBtn").click(function(){
                    $("#editForm").submit();
                });

                //点击修改按钮
                $(".edit_Btn").click(function(){
                    var json=$(this).data("json");
                    console.log(json);
                    $("#strategyCommentId").val(json.id);
                    $("#state").val(json.state);
                    $("#strategyCommentModal").modal("show");
                });

                //图片显示
                //选择器 取出来的是一堆 数据
                var imgs = $('.imgUrls');
                //遍历每一个元素
                for (n=0;n < imgs.length;n++){
                    //拿到每个元素
                    var temp = $(imgs[n]);
                    //每个标签里的内容
                    //进行切割
                    var contents =  temp.html().split(';')
                    //清空标签里原来的字符串
                    temp.empty();
                    //在原来的标签下进行 追加图片的子元素，因为有多张图片的情况所以要 遍历追加
                    for(i=0;i<contents.length -1;i++){
                        //追加 图片
                        temp.append("<img src="+contents[i]+" width='50px' style='margin-right:5px' >");

                    }
                }

        });
    </script>

    <style type="text/css">
        img{
            cursor: pointer;
            transition: all 0.6s;
        }
        img:hover{
            transform: scale(5.5);
            z-index: 999;
            POSITION: relative;
        }

    </style>
</head>

<body>

<div class="container">
<#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
		<#assign currentMenu = "strategyComment" />
				<#include "../common/menu.ftl" />
        </div>
        <div class="col-sm-9">
            <div class="page-header">
                <h3>攻略评论管理</h3>
            </div>
            <div class="row">
                <!-- 提交分页的表单 -->
                <form id="searchForm" class="form-inline" method="post" action="/strategyComment/list.do">
                    <input type="hidden" name="currentPage" id="currentPage" value="1"/>
                </form>
            </div>

            <div class="row">
                <table class="table">
                    <thead>
                    <tr>
                        <th>评论者</th>
                        <th>时间</th>
                        <th>图片</th>
                        <th>星星</th>
                        <th>攻略</th>
                        <th>状态</th>
                        <th width="30%">内容</th>
                        <th>修改状态</th>
                    </tr>
                    </thead>
                    <tbody>
					<#list pageInfo.list as vo>
                    <tr>
                        <td>${(vo.user.nickName)!""}</td>
                    <td>${(vo.createTime?string('yyyy-MM-dd HH:mm:ss'))!""}</td>
                     <td class="imgUrls">${vo.imgUrls!""}</td>
                     <td>${(vo.starNum)!""}</td>
                     <td>${(vo.strategy.title)!""}</td>
                     <td>
                         <#if vo.state == -1>
                             禁用
                         <#elseif vo.state == 0>
                             正常
                         <#elseif vo.state == 1>
                             推荐
                         </#if>
                     </td>
                     <td>
                       ${(vo.content)!""}
                    </td>
                     <td>
                         <a href="javascript:void(-1);" class="edit_Btn"  data-json='${vo.json}'>设置状态</a>
                     </td>

                 </tr>
                 </#list>
                 </tbody>
             </table>

             <div style="text-align: center;">
                 <ul id="pagination" class="pagination"></ul>
             </div>
         </div>
     </div>
 </div>
</div>

<div id="strategyCommentModal" class="modal" tabindex="-1" role="dialog">
 <div class="modal-dialog" role="document">
     <div class="modal-content">
         <div class="modal-header">
             <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
             <h4 class="modal-title">修改状态</h4>
         </div>
         <div class="modal-body">
             <form id="editForm" class="form-horizontal" method="post" action="/strategyComment/updateState.do" style="margin: -3px 118px">
                 <input id="strategyCommentId" type="hidden" name="id" value="" />
                    <div class="form-group">
                        <label class="col-sm-4 control-label">状态</label>
                        <div class="col-sm-6">
                            <select id="state" class="form-control" autocomplete="off" name="state">
                                <option value="-1">禁用</option>
                                <option value="0">正常</option>
                                <option value="1">推荐</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <a href="javascript:void(0);" class="btn btn-success" id="saveBtn" aria-hidden="true">保存</a>
                <a href="javascript:void(0);" class="btn" data-dismiss="modal" aria-hidden="true">关闭</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>